.class public final Lcom/ninesky/browser/setting/e;
.super Ljava/lang/Object;


# instance fields
.field private final a:J

.field private b:J

.field private c:Lcom/ninesky/browser/setting/g;


# direct methods
.method public constructor <init>(Lcom/ninesky/browser/setting/g;Lcom/ninesky/browser/setting/f;)V
    .locals 11

    const-wide/32 v9, 0x100000

    const-wide/16 v7, 0x0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object p1, p0, Lcom/ninesky/browser/setting/e;->c:Lcom/ninesky/browser/setting/g;

    iget-object v0, p0, Lcom/ninesky/browser/setting/e;->c:Lcom/ninesky/browser/setting/g;

    invoke-interface {v0}, Lcom/ninesky/browser/setting/g;->a()J

    move-result-wide v0

    iget-object v2, p0, Lcom/ninesky/browser/setting/e;->c:Lcom/ninesky/browser/setting/g;

    invoke-interface {v2}, Lcom/ninesky/browser/setting/g;->b()J

    move-result-wide v2

    cmp-long v4, v2, v7

    if-lez v4, :cond_0

    cmp-long v4, v0, v7

    if-lez v4, :cond_0

    cmp-long v4, v0, v2

    if-lez v4, :cond_1

    :cond_0
    move-wide v0, v7

    :goto_0
    iput-wide v0, p0, Lcom/ninesky/browser/setting/e;->a:J

    iget-wide v0, p0, Lcom/ninesky/browser/setting/e;->a:J

    const-wide/16 v2, 0x4

    div-long/2addr v0, v2

    invoke-interface {p2}, Lcom/ninesky/browser/setting/f;->a()J

    move-result-wide v2

    invoke-static {v0, v1, v2, v3}, Ljava/lang/Math;->max(JJ)J

    move-result-wide v0

    iput-wide v0, p0, Lcom/ninesky/browser/setting/e;->b:J

    return-void

    :cond_1
    const/4 v4, 0x2

    div-long v5, v2, v9

    long-to-double v5, v5

    invoke-static {v5, v6}, Ljava/lang/Math;->log10(D)D

    move-result-wide v5

    invoke-static {v5, v6}, Ljava/lang/Math;->floor(D)D

    move-result-wide v5

    double-to-int v5, v5

    shl-int/2addr v4, v5

    int-to-long v4, v4

    div-long/2addr v2, v4

    long-to-double v2, v2

    invoke-static {v2, v3}, Ljava/lang/Math;->floor(D)D

    move-result-wide v2

    const-wide/16 v4, 0x2

    div-long/2addr v0, v4

    long-to-double v0, v0

    invoke-static {v0, v1}, Ljava/lang/Math;->floor(D)D

    move-result-wide v0

    invoke-static {v2, v3, v0, v1}, Ljava/lang/Math;->min(DD)D

    move-result-wide v0

    double-to-long v0, v0

    cmp-long v2, v0, v9

    if-gez v2, :cond_2

    move-wide v0, v7

    goto :goto_0

    :cond_2
    rem-long v2, v0, v9

    cmp-long v2, v2, v7

    if-nez v2, :cond_3

    const/4 v2, 0x0

    :goto_1
    int-to-long v2, v2

    div-long/2addr v0, v9

    add-long/2addr v0, v2

    mul-long/2addr v0, v9

    goto :goto_0

    :cond_3
    const/4 v2, 0x1

    goto :goto_1
.end method


# virtual methods
.method public final a()J
    .locals 2

    iget-wide v0, p0, Lcom/ninesky/browser/setting/e;->b:J

    return-wide v0
.end method

.method public final a(JJJLandroid/webkit/WebStorage$QuotaUpdater;)V
    .locals 6

    const-wide/16 v4, 0x0

    iget-wide v0, p0, Lcom/ninesky/browser/setting/e;->a:J

    sub-long/2addr v0, p5

    iget-wide v2, p0, Lcom/ninesky/browser/setting/e;->b:J

    sub-long/2addr v0, v2

    cmp-long v2, v0, v4

    if-gtz v2, :cond_0

    invoke-interface {p7, p1, p2}, Landroid/webkit/WebStorage$QuotaUpdater;->updateQuota(J)V

    :goto_0
    return-void

    :cond_0
    cmp-long v2, p1, v4

    if-nez v2, :cond_2

    cmp-long v0, v0, p3

    if-ltz v0, :cond_1

    move-wide v0, p3

    :goto_1
    invoke-interface {p7, v0, v1}, Landroid/webkit/WebStorage$QuotaUpdater;->updateQuota(J)V

    goto :goto_0

    :cond_1
    move-wide v0, v4

    goto :goto_1

    :cond_2
    const-wide/32 v2, 0x100000

    invoke-static {v2, v3, v0, v1}, Ljava/lang/Math;->min(JJ)J

    move-result-wide v0

    add-long/2addr v0, p1

    goto :goto_1
.end method

.method public final a(JJLandroid/webkit/WebStorage$QuotaUpdater;)V
    .locals 6

    const-wide/32 v4, 0x80000

    iget-wide v0, p0, Lcom/ninesky/browser/setting/e;->a:J

    sub-long/2addr v0, p3

    iget-wide v2, p0, Lcom/ninesky/browser/setting/e;->b:J

    sub-long/2addr v0, v2

    add-long v2, p1, v4

    cmp-long v0, v0, v2

    if-gez v0, :cond_0

    const-wide/16 v0, 0x0

    invoke-interface {p5, v0, v1}, Landroid/webkit/WebStorage$QuotaUpdater;->updateQuota(J)V

    :goto_0
    return-void

    :cond_0
    iget-wide v0, p0, Lcom/ninesky/browser/setting/e;->b:J

    add-long v2, p1, v4

    add-long/2addr v0, v2

    iput-wide v0, p0, Lcom/ninesky/browser/setting/e;->b:J

    iget-wide v0, p0, Lcom/ninesky/browser/setting/e;->b:J

    invoke-interface {p5, v0, v1}, Landroid/webkit/WebStorage$QuotaUpdater;->updateQuota(J)V

    goto :goto_0
.end method
